<?php

namespace App\Http\Requests\Admin\Panx\OperateLog;

use App\Http\Requests\ApiRequest;

/**
 * @property array time_range
 * @property string log_type_id
 * @property string operatorable_id
 * @property string logable_id
 * @property string operatorable_type
 * @property string customer_id
 * @property string store_id
 * @property string order_column
 * @property string sort
 */
class OperateLogIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'time_range'        => 'nullable|array',
            'time_range.*'      => 'required|date',
            'log_type_id'       => 'nullable|int|min:0',
            'operatorable_type' => 'nullable|string|in:PanxAdmin,CustomerAdmin,StoreAdmin',
            'operatorable_id'   => 'nullable|int|min:0',
            'customer_id'       => 'nullable|int|min:0',
            'store_id'          => 'nullable|int|min:0',
            'order_column'      => 'nullable|string',
            'sort'              => 'nullable|string|in:DESC,ASC',
        ];
    }
}
